﻿/* Copyright © 2010 Will Shelley
 * All Rights Reserved. See the license.txt file for more information. */
using System;
using System.Collections.Generic;
using System.Text;

namespace System
{
    /// <summary>
    /// Represents a Uniform Resource Name.
    /// </summary>
    public sealed class Urn
    {
        #region Constructors - public
        /// <summary>
        /// Initializes a new instance of the <see cref="System.Urn"/> class.
        /// </summary>
        /// <param name="urn"></param>
        public Urn(string urn)
        {
            throw new NotImplementedException();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="System.Urn"/> class.
        /// </summary>
        /// <param name="identifier"></param>
        /// <param name="value"></param>
        public Urn(string identifier, string value)
        {
            throw new NotImplementedException();
        }
        #endregion
        #region Fields - Private
        private string namespaceIdentifier;
        private string namespaceSpecificString;
        #endregion
        #region Methods
        /// <summary>
        /// Converts the string representation of a Uniform Resource Name into it's <see cref="System.Urn"/> instance equivalent.
        /// </summary>
        /// <param name="rawUrn">A string containing a URN to convert.</param>
        /// <returns></returns>
        public static Urn Parse(string rawUrn)
        {
            throw new NotImplementedException();
        }
        /// <summary>
        /// Converts the string representation of a Uniform Resource Name into it's <see cref="System.Urn"/> instance equivalent.
        /// A return value indicates whether the conversion succeeded.
        /// </summary>
        /// <param name="rawUrn">A string containing a URN to convert.</param>
        /// <param name="urn"></param>
        /// <returns></returns>
        public static bool TryParse(string rawUrn, out Urn urn)
        {
            try
            {
                urn = Urn.Parse(rawUrn);
                return true;
            }
            catch (UrnParseException parseException)
            {
                urn = null;
                return false;
            }
        }
        #endregion
        #region Properties
        /// <summary>
        /// Gets or sets the Namespace Identifier of the current <see cref="System.Urn"/>.
        /// </summary>
        public string Identifier
        {
            get
            {
                return this.namespaceIdentifier;
            }
            set
            {
                //TODO: Input validation
                this.namespaceIdentifier = value;
            }
        }
        /// <summary>
        /// Gets or sets the Namespace-Specific String of the current <see cref="System.Urn"/>.
        /// </summary>
        public string Value
        {
            get
            {
                return this.namespaceSpecificString;
            }
            set
            {
                //TODO: Input validation
                this.namespaceSpecificString = value;
            }
        }
        #endregion
    }
}
